// miniprogram/pages/input/input.js
var EAYn, EApcn;
Page({

  onLoad(e) {
    var that = this;
  },
  EAYnd : function(e) {
    EAYn = e.detail.value
    this.setData({
      yybl: EAYn
     
    })
  },
  EAPCnd: function (e) {
    EApcn = e.detail.value
    this.setData({
      pcbl: EApcn
      
    })
  },
  EAYInput: function (e) {
    var value = e.detail.value
    if (!EAYn ||!EApcn) {
      wx.showToast({
        title: '请输入原液浓度和配出浓度',
        icon: 'none'
      })
    }
    else
    {
      this.setData({
        EAPCl: parseInt(value) * parseInt(EAYn) / parseInt(EApcn),
        water: value * (parseInt(EAYn) / parseInt(EApcn) - 1)
      })
    }
   
    // 或者直接返回字符串,光标在最后边
    // return value.replace(/11/g,'2'),
  },
  EAPCInput: function (e) {
    var value = e.detail.value
    if (!EAYn || !EApcn) {
      // console.log('酒精原液浓度和欲配出浓度不能为空')
      wx.showToast({
        title: '请输入原液浓度和配出浓度',
        icon :'none'
      })
    }
    else {
    this.setData({
      EAYl: parseInt(value) * parseInt(EApcn) / parseInt(EAYn),
      water: parseInt(value) * (1-parseInt(EApcn) / parseInt(EAYn) )
    })
    }
    // 或者直接返回字符串,光标在最后边
    // return value.replace(/11/g,'2'),
  }

})